package com.rran.study.designpattern.factory.builder;

/**
 * @author yy
 * @Type PersonDirector.java
 * @Desc 监工类 保证完整
 * @date 2020/7/23 14:58
 */
public class PersonDirector {

    private final PersonBuilder pb;

    public PersonDirector(final PersonBuilder pb) {
        this.pb = pb;
    }

    //保证完整性
    public Person createPerson() {
        this.pb
                .buildHead()
                .buildBody()
                .buildLeftHand()
                .buildRightHand()
                .buildLeftLeg()
                .buildRightLeg();
        return this.pb.getResult();
    }
}
